package a03.core.base;

import java.util.List;

/**
 * @author : scottxuan
 */
public abstract class BaseServiceImpl<T> implements BaseService<T>{

    /**
     * 获取dao操作的mapper
     * @return
     */
    protected abstract BaseMapper<T> getMapper();

    @Override
    public int insert(T record) {
        return getMapper().insert(record);
    }

    @Override
    public int insertSelective(T record) {
        return getMapper().insertSelective(record);
    }

    @Override
    public Integer insertUseGeneratedKeys(T record) {
        return getMapper().insertUseGeneratedKeys(record);
    }

    @Override
    public int insertBatch(List<T> records) {
        return getMapper().insertBatch(records);
    }

    @Override
    public int updateByPrimaryKey(T record) {
        return getMapper().updateByPrimaryKey(record);
    }

    @Override
    public int updateByPrimaryKeySelective(T record) {
        return getMapper().updateByPrimaryKeySelective(record);
    }

    @Override
    public T selectByPrimaryKey(Object id) {
        return getMapper().selectByPrimaryKey(id);
    }

    @Override
    public List<T> selectByPrimaryKeys(List<?> ids) {
        return getMapper().selectByPrimaryKeys(ids);
    }

    @Override
    public T selectOneByRecord(T record) {
        return getMapper().selectOneByRecord(record);
    }

    @Override
    public List<T> selectByRecord(T record) {
        return getMapper().selectByRecord(record);
    }

    @Override
    public int deleteByPrimaryKey(Object id) {
        return getMapper().deleteByPrimaryKey(id);
    }

    @Override
    public int deleteByPrimaryKeys(List<?> ids) {
        return getMapper().deleteByPrimaryKeys(ids);
    }

    @Override
    public int logicDeleteByPrimaryKey(Object id) {
        return getMapper().logicDeleteByPrimaryKey(id);
    }

    @Override
    public int logicDeleteByPrimaryKeys(List<?> ids) {
        return getMapper().logicDeleteByPrimaryKeys(ids);
    }
}
